package gem.model.core;

public class Department implements DBEntity {

    private String m_DepartmentTitle;
    private int m_DepartmentId;

    public Department setTitle(String s) {
        m_DepartmentTitle = s;
        return this;
    }

    public String getTitle() {
        return m_DepartmentTitle;
    }

    public int getId() {
        return m_DepartmentId;
    }

    public Department setId(int id) {
        m_DepartmentId = id;
        return this;
    }
    java.util.Collection<ScienceDomain> m_ScienceDomains = null;

    //-----------------------------------------------------------------------------------//
    public java.util.Collection<ScienceDomain> getScienceDomains() {
        return m_ScienceDomains;
    }
    //-----------------------------------------------------------------------------------//

    public Department setScienceDomains(java.util.Collection<ScienceDomain> col) {
        this.m_ScienceDomains = col;
        return this;
    }
    //-----------------------------------------------------------------------------------//

    public Department addScienceDomain(ScienceDomain s) {
        if (!m_ScienceDomains.contains(s)) {
            m_ScienceDomains.add(s);
            s.setDepartment(this);
        }
        return this;
    }
    //-----------------------------------------------------------------------------------//

    public Department removeScienceDomain(ScienceDomain s) {
        m_ScienceDomains.remove(s);

        return this;
    }
    //-----------------------------------------------------------------------------------//

    @Override
    public String toString() {
        return this.m_DepartmentTitle;
    }
    //-----------------------------------------------------------------------------------//

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Department == false) {
            return false;
        }
        if (this == obj) {
            return true;
        }
        Department temp = (Department) obj;
        return ((temp.getId() == this.getId())
                && (temp.getTitle().equals(this.getTitle())));
    }
    //-----------------------------------------------------------------------------------//

    @Override
    public int hashCode() {
        return getTitle().hashCode();
    }

    //-----------------------------------------------------------------------------------//
    public EntityType getType() {
        return EntityType.DEPARTMENT;
    }
    //-----------------------------------------------------------------------------------//
    //-----------------------------------------------------------------------------------//
    public String getCaption()
    {
        return getTitle();
    }
    //-----------------------------------------------------------------------------------//

}
